package com.yegs.jltqc.controller;

import com.yegs.jltqc.TO.NamePageQuery;
import com.yegs.jltqc.VO.BaseMenu;
import com.yegs.jltqc.VO.Version;
import com.yegs.jltqc.common.StoreException;
import com.yegs.jltqc.config.Msg;
import com.yegs.jltqc.service.BaseMenuService;
import com.yegs.jltqc.service.VersionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/version")
public class VersionController {

    @Autowired
    private VersionService versionService;

    @PostMapping("/save")
    public Msg save(@RequestBody Version version){
        try{
            versionService.save(version);
            return Msg.success();
        }catch (StoreException e){
            return Msg.error(e.getMessage());
        }
    }
    @GetMapping("/list")
    public Msg list(){
        return Msg.success("list",versionService.list());
    }


    @GetMapping("/getNext")
    public Msg getNext(@RequestParam Long id){
        return Msg.success("data",versionService.getNext(id));
    }



}
